<template>
  <div class="app-container">
    <div class="searchBox">
      <el-form :inline="true" :model="search" ref="searchForm">

        <el-row>
          <el-col :span="6">
            <el-form-item label="申请人：" prop="applyUserName">
              <el-input v-model="search.applyUserName" placeholder="请输入内容"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="考核人：" prop="userName">
              <el-input v-model="search.userName" placeholder="请输入内容"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="指标编码：" prop="normCode">
              <el-input v-model="search.normCode" placeholder="请输入内容"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item style="margin-top: -2px">
              <el-button type="primary" @click="searchQuery">查询</el-button>
              <el-button type="info" @click="search = {};searchQuery()">重置</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>

    <qm-table
            :data="query"
            :formOptions="{ labelWidth: '120px' }"
            :showCheckbox="false"
            :showMenu="false"
            :showToolbar="false"
            :isCustomForm="true"
            :modalOptions="{ height: 630 }"
            ref="qmTable"
            keyProp="applyId"
            menuType="text"
    >
      <qm-table-column field="applyUserName">申请人</qm-table-column>
      <qm-table-column field="userName">考核人</qm-table-column>
      <qm-table-column field="applyStatus" :renderFunc="renderApplyStatus">申请状态</qm-table-column>
      <qm-table-column field="normName">指标名称</qm-table-column>
      <qm-table-column field="normCode">指标编码</qm-table-column>
      <qm-table-column field="scoresType" :renderFunc="renderScoresType">考核类型</qm-table-column>
      <qm-table-column field="scores">分数</qm-table-column>
      <qm-table-column field="remark">情况说明</qm-table-column>
    </qm-table>

  </div>
</template>

<script>
    import Controller from "@/libs/framework/controller";

    export default class Instance extends Controller {
        onBeforeInit() {
            this.urls = {
                query: [{url: "/eip/kpi/apply/query", method: "post"}],
                save: "/eip/kpi/apply/save",
                delete: "/eip/kpi/apply/delete",
                entity: "/eip/kpi/apply/getEntity",
                model: "/eip/kpi/apply/getListModel",
            };
        }

        mixin() {
            return {
                data() {
                    return {}
                },
                methods: {
                    renderScoresType(data, row, column) {
                        let find = this.super.$util.find(
                            this.controlData.scoresTypes,
                            (item) => {
                                return item.value === data;
                            }
                        );
                        return (find || {}).key;
                    },
                    renderApplyStatus(data, row, column) {
                        let find = this.super.$util.find(
                            this.controlData.status,
                            (item) => {
                                return item.value === data;
                            }
                        );
                        return (find || {}).key;
                    }
                }
            }
        }
    }
</script>

<style scoped>

</style>
